/**
 * 2025/01/01 - 2025/12/31
 */
package com.snail.starter.db.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.snail.starter.db.annotation.mapstruct.ToEnableOrDisable;
import lombok.Getter;
import lombok.ToString;

import java.util.Arrays;

/**
 *
 * @author zgadmin
 * @date 2025/7/1 16:31
 *
 */
@Getter
@ToString
public enum EnableOrDisEnableEnum implements IEnum<Integer> {

    ENABLE(0, "启用"),
    DISABLE(1, "禁用"),
    ;

    private final Integer value;

    private final String desc;

    EnableOrDisEnableEnum(Integer value, String desc){
        this.value = value;
        this.desc = desc;
    }

    @ToEnableOrDisable
    public static EnableOrDisEnableEnum getEnum(Integer value) {
        if (null == value) {
            return DISABLE;
        }
        return Arrays.stream(values()).filter(e -> e.getValue().equals(value)).findFirst().orElse(DISABLE);
    }

}